package com.capgemini.simpleappblanche.utils.converters;

import org.dozer.DozerConverter;

public class DisabledConverter extends DozerConverter<Boolean, String>{

	public DisabledConverter() {
		super(Boolean.class, String.class);
	}

	@Override
	public String convertTo(Boolean source, String destination) {
		if (source == null) {
			return "Non";
		}
		return source.booleanValue()? "Oui" : "Non";
	}

	@Override
	public Boolean convertFrom(String source, Boolean destination) {
		if ("OUI".equalsIgnoreCase(source)) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
	}

}
